﻿using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace blackhouse.AspQuartzWrapper {
    public class QuartzJobSetup {

        private Type jobType;

        public string Name { get; set; }
        public string JobAssembly { get; set; }
        public string CronTriggerSchedule { get; set; }

        internal Type TryGetJobAssemblyType() {
            if (this.jobType == null) {
                this.jobType = Type.GetType(this.JobAssembly, true, false);
                if (!typeof(IJob).IsAssignableFrom(this.jobType))
                    throw new ArgumentException(this.Name + " (" + this.JobAssembly + ") nie implementuje interfejsu IJob");
            }
            return this.jobType;
        }

    }
}